﻿using System;
using System.Collections.Generic;
using System.Text;
using zdzh.zdmgr.COL;

namespace zdzh.zdmgr.SFL
{
    public class WebShow
    {
        public static string WS_type(Fangyuan fangyuan)
        {
            return WS_type(fangyuan.Type);
        }
        public static string WS_type(object type)
        {
            List<string> lstType = new List<string>();
            lstType.Add("全部");
            lstType.Add("多层");
            lstType.Add("车库");
            lstType.Add("商服");
            lstType.Add("阁楼");
            lstType.Add("高层");

            return lstType[Convert.ToInt32(type)];
        }

        public static string WS_build(Fangyuan fangyuan)
        {
            return WS_build(fangyuan.Build, fangyuan.Unit, fangyuan.Floor, fangyuan.Room);
        }
        public static string WS_build(object build, object unit, object floor, object room)
        {
            string ret = "---";
            if (build != null)
                ret = build.ToString()+" - ";

            if (unit == null && room != null)
                ret += room.ToString();
            else
                ret += unit + " - " + floor + "0" + room;
            return ret;
        }

        public static string WS_area(Fangyuan fangyuan)
        {
            return WS_area(fangyuan.Designarea, fangyuan.Area);
        }
        public static string WS_area(object designarea, object area)
        {
            string ret = "";
            if (designarea == null)
                ret = "---";
            else
                ret = string.Format("{0:F2}", designarea);
            ret += " / ";
            if (area == null)
                ret += "---";
            else
                ret += string.Format("{0:F2}", area);
            return ret;
        }

        public static string WS_state(Fangyuan fangyuan)
        {
            return WS_state(fangyuan.State);
        }
        public static string WS_state(object state)
        {
            List<string> lstState = new List<string>();
            lstState.Add("---");
            lstState.Add("待售");
            lstState.Add("预定");
            lstState.Add("回迁");
            lstState.Add("销售");
            lstState.Add("锁定");
            lstState.Add("其他");
            return lstState[Convert.ToInt32(state)];
        }
    }
}
